



ALTER     proc sp_get_line_item_pending_quantity
@line_item_id int,
@qty_shipped int OUTPUT
AS
begin
	--declare @qty_shipped int
	declare @shipped_qty_sum int
	set @shipped_qty_sum = (select  isnull(sum(CSLIT_Qty_Shipped), 0) from Customer_Shipping_Line_Item_Table where LineItem_ID = @line_item_id AND CSLIT_Status != 'CANCELLED')
	set @qty_shipped  = (select  (avg(COOL_Qty) - @shipped_qty_sum) from Customer_Open_Order_LineItem where LineItem_ID = @line_item_id)
	select @qty_shipped
	return
end 



